package code.google.jcontainer.resolver;

import code.google.jcontainer.AbstractContainer;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

/**
 * Context object for resolving Method annotation
 * 
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 */
public class MethodResolveContext extends ResolveContext{

    /**
     * the annotated method
     */
    private Method method;

    /**
     * parameters to invoke method
     */
    private Object[] parameters;

    /**
     * result of the method returned 
     */
    private Object result;

    public MethodResolveContext(AbstractContainer container, String componentName, Class componentClass, Object component, Method method, Object[] parameters, Object result) {
        super(container, componentName, componentClass, component);
        this.method = method;
        this.parameters = parameters;
        this.result = result;
    }

    /**
     * get the annotated method
     */
    public Method getMethod() {
        return method;
    }

    /**
     * get the parameters to invoke the method
     */
    public Object[] getParameters() {
        return parameters;
    }

    /**
     * set parameters, it replaces the original parameters
     */
    public void setParameters(Object[] parameters) {
        this.parameters = parameters;
    }

    /**
     * get result that method returned
     */
    public Object getResult() {
        return result;
    }

    /**
     * set result, it replaces the original result
     */
    public void setResult(Object result) {
        this.result = result;
    }

}